package com.financing.platform.dao.impl;

import java.util.List;
import com.financing.platform.dao.impl.BaseDaoImpl;
import com.financing.platform.dao.IFpFundCMDao;
import com.financing.platform.dto.FpFundCMDTO;
import com.financing.platform.util.SqlName;
import java.sql.SQLException;
import java.util.Collections;

import org.springframework.stereotype.Repository;

/**
 * @Description:实现类
 * @author caojiayao
 * @version 1.0
 * @created 
 */
@Repository("fpFundCM")
public class FpFundCMDaoImpl extends BaseDaoImpl implements IFpFundCMDao {
	
	@Override
	public FpFundCMDTO getFpFundCM(Integer id) {
		try{
			return (FpFundCMDTO)this.sqlMapClient.queryForObject(SqlName.fpFundCM,id);
		} catch (SQLException e) {
			log.error("get fpFundCM error:",e);
			return null;
		}
	}
	
	
	@Override
	public Integer insertFpFundCM(FpFundCMDTO dto) {
		try {
		     return (Integer) this.sqlMapClient.insert(SqlName.insertFpFundCM,dto);
		} catch (SQLException e) {
			log.error("add fpFundCM error:",e);
			return 0;
		}
	}

	
	@Override
	public Integer updateFpFundCM(FpFundCMDTO dto) {
		try {
			return (Integer) this.sqlMapClient.update(SqlName.updateFpFundCM, dto);
		} catch (SQLException e) {
			this.log.error("update fpFundCM error 1!",e);
			return 0;
		}
	}
	
	@Override
	public Integer delFpFundCM(Integer id) {
		try{
			 return (Integer) this.sqlMapClient.delete(SqlName.delFpFundCM, id);
		} catch (SQLException e) {
			log.error("del fpFundCM error:",e);
			return 0;
		}
	}
	
	@Override
	public List<FpFundCMDTO> listFpFundCM(FpFundCMDTO dto) {
		try {
			return (List<FpFundCMDTO>)this.sqlMapClient.queryForList(SqlName.listFpFundCM, dto);
		} catch (SQLException e) {
			log.error("Query fpFundCM note list error !", e);
			return Collections.emptyList();
		}
	}
	
	@Override
	public List<FpFundCMDTO> listFpFundCMByPage(FpFundCMDTO dto) {
		try {
			return (List<FpFundCMDTO>)this.sqlMapClient.queryForList(SqlName.listFpFundCMByPage, dto);
		} catch (SQLException e) {
			log.error("Query fpFundCM note list error !", e);
			return Collections.emptyList();
		}
	}
	
	
	
	public Integer countFpFundCM(FpFundCMDTO dto){
		try {
			return (Integer)this.sqlMapClient.queryForObject(SqlName.countFpFundCM, dto);
		} catch (SQLException e) {
			log.error("Query fpFundCM note list error !", e);
			return 0;
		}
	}
	
	/**
	final static public String fpFundCM = "fpFundCM.getFpFundCM";
	final static public String insertFpFundCM = "fpFundCM.insertFpFundCM";
	final static public String updateFpFundCM = "fpFundCM.updateFpFundCM";
	final static public String delFpFundCM = "fpFundCM.delFpFundCM";
	final static public String listFpFundCM = "fpFundCM.listFpFundCM";
	final static public String countFpFundCM = "fpFundCM.countFpFundCM";
	**/
}
